<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改调拨单')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-requisitio-edit" th:object="${gysptWarehouseRequisitio}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="warehouseId" th:field="*{warehouseId}" type="hidden" />
            <input name="towarehouseId" th:field="*{towarehouseId}" type="hidden" />
            <h4 class="form-header h4">单据信息</h4>
            <div class="form-group">	
	            <label class="col-sm-1 control-label ">原仓库位置：</label>
	            <div class="col-sm-2">
	            	<label th:text="${warehouse?.name}" class="control-label"></label>
	            </div>
	            <label class="col-sm-1 control-label ">目标仓库位置：</label>
	            <div class="col-sm-2">
	            	<label th:text="${towarehouse?.name}" class="control-label"></label>
	            </div>
                <label class="col-sm-1 control-label">调拨单号：</label>
                <div class="col-sm-2">
                	<label th:text="*{requisitioNo}" class="control-label"></label>
                </div>
                <label class="col-sm-1 control-label">调拨日期：</label>
                <div class="col-sm-2">
                	<label th:text="${#dates.format(gysptWarehouseRequisitio.requisitioriq, 'yyyy-MM-dd')}" class="control-label"></label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label">备注：</label>
                <div class="col-sm-11">
                	<label th:text="*{memo}" class="control-label"></label>
                </div>
            </div>
            <h4 class="form-header h4">物料信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="col-sm-12 select-table table-striped">
					    <table id="bootstrap-table"></table>
					</div>
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
          	<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:src="@{/js/math.min.js}"></script>
    <script th:src="@{/js/jquery.tmpl.js}"></script>
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/requisitio";
        $("#form-requisitio-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/edit", $('#form-requisitio-edit').serialize());
            }
        }
        
        var data = [[${gysptWarehouseRequisitio.items}]];
        
        /**商品单据**/
        $(function() {
	    	// 初始化数据, 可以由后台传过来
		    var options = {
		    	data: data,
                pagination: false,
		        showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
		        columns: [{
		            checkbox: true
		        },
		        {
		        	field: 'index',
		        	align: 'center',
		        	title: "序号",
                    formatter: function (value, row, index) {
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='items[%s].xuh' value='%s'>", $.table.serialNumber(index));
                    	var columnId = $.common.sprintf("<input type='hidden' name='items[%s].jine' value='%s'>", 0);
                    	var columnZdjine = $.common.sprintf("<input type='hidden' class='form-control zdjinecount' name='items[%s].zdjine' value='%s'>", row.zdjine);
                    	return columnIndex + $.table.serialNumber(index) + columnId + columnZdjine;
                    }
                },
		        {
		            field: 'mingc',
		            align: 'center',
		            title: '物料名称',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input type='hidden' name='items[%s].mingc' value='%s'>", index, value);
		        		return html +value;
                    }
		        },{
		            field: 'clpp',
		            align: 'center',
		            title: '材料品牌',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input type='hidden' name='items[%s].clpp' value='%s'>", index, value);
		        		return html +value;
                    }
		        },{
		            field: 'guig',
		            align: 'center',
		            title: '规格型号',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input type='hidden' name='items[%s].guig' value='%s'>", index, value);
		        		return html +value;
                    }
		        },{
		            field: 'danw',
		            align: 'center',
		            title: '计量单位',
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input type='hidden' name='items[%s].danw' value='%s'>", index, value);
		        		return html +value;
                    }
		        },{
		            field: 'shul',
		            align: 'center',
		            title: '调拨数量',
		            width: 120,
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control shulcount' type='hidden' name='items[%s].shul' value='%s'>", index, value);
		        		return html +value;
                    }
		        },{
		            field: 'memo',
		            align: 'center',
		            title: '备注',
		            width: 200,
		            formatter: function(value, row, index) {
		            	var html = $.common.sprintf("<input class='form-control memocount' type='hidden' name='items[%s].memo' value='%s'>", index, value);
		        		return html+value;
                    }
		        }]
		    };
		    $.table.init(options);
		    
		});
    </script>
</body>
</html>